//
//  DepartmentCell.m
//  DrProcessTable
//
//  Created by 白岩凇 on 2016/10/4.
//  Copyright © 2016年 白岩凇. All rights reserved.
//

#import "DepartmentCell.h"

@interface DepartmentCell ()
@property (weak, nonatomic) IBOutlet UILabel *DepartmentName;
@property (weak, nonatomic) IBOutlet UILabel *DepartmentInfo;

@end

@implementation DepartmentCell


//快速获得cell
+ (instancetype)cellWithTableView:(UITableView*)tableVeiw{
    
    static NSString* ID=@"Dptmt_ID";
    DepartmentCell* cell=[tableVeiw dequeueReusableCellWithIdentifier:ID];
    if (cell==nil) {
        cell=[[[NSBundle mainBundle]loadNibNamed:NSStringFromClass(self) owner:nil options:nil]lastObject];
    }
    return cell;
}

- (void)setModel:(DptmtCellModel *)model{
    _model=model;
    self.DepartmentName.text=model.DepartmentName;
    self.DepartmentInfo.text=model.DepartmentInfo;
    [self layoutIfNeeded];
    CGFloat need=CGRectGetMaxY(self.DepartmentInfo.frame);
    model.h=need+5;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    self.DepartmentInfo.preferredMaxLayoutWidth=[UIScreen mainScreen].bounds.size.width-16;//为了保证计算出来的数值和显示出来的一致
}



@end
